import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PlayHistoryVO, PlayHistoryForm, PlayHistoryQuery } from '@/api/business/playHistory/types';

/**
 * 查询统一播放记录列表
 * @param query
 * @returns {*}
 */

export const listPlayHistory = (query?: PlayHistoryQuery): AxiosPromise<PlayHistoryVO[]> => {
  return request({
    url: '/business/playHistory/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询统一播放记录详细
 * @param id
 */
export const getPlayHistory = (id: string | number): AxiosPromise<PlayHistoryVO> => {
  return request({
    url: '/business/playHistory/' + id,
    method: 'get'
  });
};

/**
 * 新增统一播放记录
 * @param data
 */
export const addPlayHistory = (data: PlayHistoryForm) => {
  return request({
    url: '/business/playHistory',
    method: 'post',
    data: data
  });
};

/**
 * 修改统一播放记录
 * @param data
 */
export const updatePlayHistory = (data: PlayHistoryForm) => {
  return request({
    url: '/business/playHistory',
    method: 'put',
    data: data
  });
};

/**
 * 删除统一播放记录
 * @param id
 */
export const delPlayHistory = (id: string | number | Array<string | number>) => {
  return request({
    url: '/business/playHistory/' + id,
    method: 'delete'
  });
};
